<!-- Message Error -->
<?php if ($this->session->flashdata('f_products')): ?>
    <div class="msg msg-ok boxwidth">
        <p><strong><?php echo $this->session->flashdata('f_products'); ?></strong></p>
    </div>
<?php endif; ?>

<!-- Box -->
<div class="box">
    <!-- Box Head -->
    <div class="box-head">
        <h2>Edit product</h2>
    </div>
    <!-- End Box Head -->

    <form action="<?php echo base_url();?>admin/products/edit_submit" method="post" enctype="multipart/form-data">

        <!-- Form -->
        <div class="form">
            <p>
                <label>Name <span>(Required Field)</span></label>
                <input type="text" class="field size1" name="name" value="<?php echo $product->name;?>"/>
                <input type="hidden" class="field size1" name="id" value="<?php echo $product->id;?>"/>
            </p>
            <!--
            <p class="inline-field">
                <label>Top Category <span>(Required Field)</span></label>
                <select class="field size1" name="parent_cat" onchange="change_cat()" id="parent_cat">
                    <?php foreach($parent_cat->result() as $c):?>
                    <option value="<?php echo $c->products_cat_id;?>" <?php echo ($product->products_cat_parent==$c->products_cat_id)?'selected':'';?>><?php echo $c->products_cat_title;?></option>
                    <?php endforeach;?>
                </select>
            </p>
            -->
            <p class="inline-field">
                <label>Category <span>(Required Field)</span></label>
                <select class="field size1" name="category" id="products_cat">
                    <?php foreach($products_cat->result() as $c):?>
                    <option value="<?php echo $c->products_cat_id;?>" <?php echo ($product->products_cat_id==$c->products_cat_id)?'selected':'';?>><?php echo $c->products_cat_title;?></option>
                    <?php endforeach;?>
                </select>
            </p>
            <p>
                <label>Main Photo</label>
                <img class="admin-designer-photo" src="<?php echo base_url();?>photo/products/main/<?php echo $product->main_photo;?>"/>
            </p>
            <p>
                <label>Change Main Photo <span>(Required Field)</span></label>
                <input type="file" class="field size1" name="main_photo"/>
            </p>
            <p>
                <label>Description <span>(Required Field)</span></label>
                <textarea class="field size1" rows="10" cols="30" name="description"><?php echo $product->description;?></textarea>
            </p>
            <p>
                <label>Price <span>(Required Field)</span></label>
                <input type="text" class="field size1" name="price" value="<?php echo $product->price;?>"/>
            </p>
            <p>
                <label>Quantity <span>(Required Field)</span></label>
                <input type="text" class="field size1" name="quantity" value="<?php echo $product->quantity;?>"/>
            </p>
            <p class="inline-field">
                <label>Designer <span>(Required Field)</span></label>
                <select class="field size1" name="designer">
                    <?php foreach($designers->result() as $d):?>
                    <option value="<?php echo $d->id;?>"><?php echo $d->nick_name;?> (<?php echo $d->full_name;?>)</option>
                    <?php endforeach;?>
                </select>
            </p>
            <p>
                <label>Dimention <span>(Required Field)</span></label>
                <input type="text" class="field size1" name="dimention" value="<?php echo $product->dimention;?>"/>
            </p>
            <p>
                <label>Materials <span>(Required Field)</span></label>
                <input type="text" class="field size1" name="materials" value="<?php echo $product->materials;?>"/>
            </p>
            <p>
                <label>Year <span>(Required Field)</span></label>
                <input type="text" class="field size1" name="year" value="<?php echo $product->year;?>"/>
            </p>
            <p>
                <label>Quantity Status <span>(Required Field)</span></label>
                <?php $options = array(
                  '1'=> 'In Stock',
                  '2'=> 'Low Stock',
                  '3'=> 'Sold Out'
                );
                echo form_dropdown('qty_status', $options, $product->qty_status,'class="field size1"');
                ?>
            </p>

        </div>
        <!-- End Form -->
        
        <!-- Form Buttons -->
        <div class="buttons">
            <input type="submit" class="button" value="submit" />
        </div>
        <!-- End Form Buttons -->
    </form>
</div>
<!-- End Box -->